/* This file is part of SpaceSim.
 
 SpaceSim is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.
 
 SpaceSim is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with SpaceSim.  If not, see <http://www.gnu.org/licenses/>. */

#include <vector>

#include "graphics.h"
#include "random.h"
#include "system.h"

class Cluster {
private:
	std::vector<System> Systems;
	int SystemCount;
	int ClusterID;
public:
	Cluster() {
		Seed(0);
	}
	Cluster(int _id) {
		Seed(_id);
	}
	
	int GetID() {
		return ClusterID;
	}
	
	void Seed(int _id) {
		Systems.clear();
		
		ClusterID = _id;
		Random::Seed(_id);
		
		SystemCount = Random::Rand(2, 10);
		
		Systems.push_back(System());
		
		Systems[0].MakeHub();
		
		for (int i = 1; i < SystemCount; i++) {
			Systems.push_back(System(i + _id * 10));
		}
	}
	
	void NextCluster() {
		ClusterID++;
		Seed(ClusterID);
	}
	
	void PrevCluster() {
		ClusterID--;
		Seed(ClusterID);
	}
	
	System *GetSystem(int system) {
		return &Systems[system];
	}
	
	int GetSystemCount() {
		return SystemCount;
	}
	
	void DrawSubWarp() {
		std::vector<System>::iterator systemIterator;
		
		int i = 0;
		
		for (systemIterator=Systems.begin(); systemIterator < Systems.end(); systemIterator++) {
			systemIterator->DrawWarp(i);
			i++;
		}
	}
	
	void DrawHubWarp();
};